package com.xinsoft.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xinsoft.entity.dto.SysFlowParam;
import com.xinsoft.entity.po.SysApproveFlow;
import com.xinsoft.mapper.SysApproveFlowMapper;
import com.xinsoft.service.SysApproveFlowService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author lijie
* @description 针对表【sys_apporve_flow(审批流程表)】的数据库操作Service实现
* @createDate 2023-05-22 13:44:38
*/
@Service
public class SysApproveFlowServiceImpl extends ServiceImpl<SysApproveFlowMapper, SysApproveFlow>
    implements SysApproveFlowService {

    @Resource
    SysApproveFlowMapper flowMapper;

    @Override
    public Object findPageListByParam(SysFlowParam param) {
        //分页
        Page<SysApproveFlow> page = new Page<SysApproveFlow>(param.getCurrentPage(), param.getPageSize());
        QueryWrapper<SysApproveFlow> queryWrapper = new QueryWrapper<>();
        //查询条件
        if(StrUtil.isNotBlank(param.getFlowName())){
            queryWrapper.like("flow_name",param.getFlowName());
        }
        if(StrUtil.isNotBlank(param.getTabName())){
            queryWrapper.like("tab_name",param.getTabName());
        }
        if(param.getFlowStatus() != null){
            queryWrapper.eq("flow_status",param.getFlowStatus());
        }
        IPage<SysApproveFlow> resultPage = flowMapper.selectPage(page, queryWrapper);
        //返回值
        return resultPage;
    }
}




